package com.hxgis.common.config.es;

import com.es.repository.ElasticRepository;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class EsBeanLoad {

    @Bean
    @Order(Integer.MIN_VALUE)
    @ConfigurationProperties(prefix = "elasticsearch")
    public com.es.config.EsClientConfig getEsClientConfig(){
        return new com.es.config.EsClientConfig();
    }


    @Bean
    public com.es.EsClient initEsClient(com.es.config.EsClientConfig esClientConfig,
                                        List<ElasticRepository> elasticRepositories){
        com.es.EsOperation.run(esClientConfig,elasticRepositories);
        return com.es.EsClient.getEsClient();
    }
}
